﻿Public Class LockForm


    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If Me.btnPassword.Text.Trim() <> "wangysjincy" Then
            ShowMessageBox("密码不正确，你没有权限进入")
            Return
        End If
        SetappSettings("LockWindows", "0")
        SaveConfig()
        DialogResult = Windows.Forms.DialogResult.OK
    End Sub

    Private Sub LockForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ShowInTaskbar = True
        Me.ContextMenuStrip1.Visible = False
        _parentForm.Visible = False
        SetappSettings("LockWindows", "1")
        SaveConfig()
    End Sub

    Private _parentForm As Form

    Public Sub New(ByVal form As Form)
        InitializeComponent()
        Me._parentForm = form
    End Sub

    Private Sub LockForm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If Me.btnPassword.Text.Trim() <> "wangysjincy" Then
            If (ShowMessageResult("权限不够，是否退出程序") <> Windows.Forms.DialogResult.Yes) Then
                e.Cancel = True
            End If
        End If
    End Sub
End Class
